
package upc.pilot.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import upc.pilot.service.ExportManagerService;

import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

@Component
public class ExportManagerServiceImpl implements ExportManagerService
{

    @Override
    public void generatePDFReport(Map<String, Object> parameterMap, List<Object> objectList)
    {
        JRDataSource dataSource = null;
        if (objectList != null)
        {
            dataSource = new JRBeanCollectionDataSource(objectList);
        }
        else
        {
            dataSource = new JREmptyDataSource();
        }

        parameterMap.put("datasource", dataSource);

    }

}
